
package com.itcs.box.server.resolver;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.itcs.box.domain.BoxRequest;
import com.itcs.box.util.LogUtils;

import io.netty.channel.ChannelHandlerContext;

/**
 * 心跳应答
 * 
 * @author LiuPeng
 * @date 2017年12月12日
 * 
 */
@Component
public class Box2002Resolver implements MsgResolverAdapter {

	private Log logger = LogFactory.getLog(getClass());

	@Override
	public boolean support(BoxRequest boxRequest) {
		return "2002".equals(boxRequest.getMessgeType());
	}

	@Override
	public void resolve(ChannelHandlerContext channelHandlerContext, BoxRequest boxRequest) {

		logger.info(LogUtils.build("2002", "通讯应答", "通讯盒:" + boxRequest.getData().getDeviceId(),
				JSON.toJSONString(boxRequest)));

	}

}
